﻿<html>
<head>
	 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>一人一本 - 试过才知道</title>

    <!--<link href="css/bootstrap.css" rel="stylesheet">-->
	<!--<link href="css/bootstrap-responsive.min.css" rel="stylesheet">-->
	<link href="css/productlist.css" rel="stylesheet">
	<link href="css/inspiritas.css" rel="stylesheet">
	<link href="css/carousel.css" rel="stylesheet">
	<script src="js/jquery-1.7.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
	<script src="js/jquery.json-2.4.js"></script>
    <script src="js/jquery.cookie.js"></script>
	<script src="js/jquery.form.js"></script>
	<script>
	$(document).ready(	
		function()
		{
			typeListClick();
			
		<?php include "htm/ready.htm";?>
			$.ajax({
				url:'index.php?act=productlist.product_list_page&product_category=<?php echo $_GET['product_category'];?>',
				type:'POST',
				success:function(data){
					//alert(data);
				}
			});

			$.getJSON('index.php?act=productlist.category_brother&product_category=<?php echo $_GET['product_category'];?>',function(data){
					for(var category in data)
					{						
					html='<li id=category_'+data[category].category_id+'>'+
						'<a style="TEXT-DECORATION:none" href="'+'productlist.php?product_category=' + data[category].category_id+'">'+data[category].category_name+'</a> '+
						'</li>';
						$('#category_list').append(html);
					}	
					$('#category_'+<?php echo $_GET['product_category'];?>).addClass('active');
					}
				);	
			
			$.getJSON('index.php?act=productlist.show_category_relation&product_category=<?php echo $_GET['product_category'];?>',function(data){
					html=
						'<a id="original_category" class="type-path" href="parenttypelist.php?product_category='+data.parent_category_id+'">'+data.original_category_name+'</a>&nbsp;&nbsp;'+
						'<span class="carat smoke">›</span>&nbsp;&nbsp;'+
						'<a id="parent_category" class="type-path" href="parenttypelist.php?product_category='+data.parent_category_id+'">'+data.parent_category_name+'</a>&nbsp;&nbsp;'+
						'<span class="carat smoke">›</span>&nbsp;&nbsp;'+
						'<span id="current_category" class="active">'+data.current_category_name+'</span>';
					$('#category_relation').append(html);
					$('#original_category_1').text(data.parent_category_name);
					
					
					}
				);
			$.getJSON('index.php?act=productlist.product_list_page&product_category=<?php echo $_GET['product_category'];?>', function(data){
						var i=0;
						var html = "";
						for(var product in data)
						{				
							if (i>0 && i%4==0) {
								html = html + '</div>';
							}
							if (i%4==0) {
								html = html + '<div class="row-fluid product-row">';
							}
							html = html +
							'<div id="BOOK_ID_00001" class="span3  book-item">'+
							'<div id="label'+i+'"></div>'+
							'<a href="' + 'productDetail.php?product_id=' + data[product].id + '">'+
							'<img src="'+data[product].image+'" class="img-rounded" width="160">'+
							'</a>'+
							'<div class="book-info-list">'+
							'<a href="' + 'productDetail.php?product_id=' + data[product].id + '" class="book-name-list">'+data[product].name+'</a>'+
							'<div id="authors">'+
							'<span class="carat juicy">›</span>'+
							'<span class="text-normal" href="#">'+data[product].author+'</span>'+
							'</div>'+
							'<div class="smoke">平装</div>'+
							'<span class="grey book-price-old">￥&nbsp;'+data[product].price+'</span>'+
							'<span class="red book-price-new">￥&nbsp;'+data[product].current_price+'</span>'+
							'</div>'+
							'</div>';
							i++;
						}
						if (i>0) {
							html = html+'</div>';
						}
						$('#product_list').append(html);
						var a=0;
						for(var product in data)
						{
							if(data[product].discount_type==3)
							{
							html2='<div class="absolute-label">'+
								'<img id = "" style="" src="img/团购图标.png">'+
								'</div>';
							$('#label'+a).append(html2);
							}
							a++;
						}
						
					}
				);
				
			
		}
		
	);
	
	function typeListClick()
	{
		$('#type-list').children(':not(".divider,h2")').click(function(){
			$(this).addClass('active');
			$(this).siblings().removeClass('active');
		});
	}
	</script>
</head>
<body>

<?php include "htm/head.htm";?>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span3">
      <ul class="nav  nav-pills nav-stacked">
		<h3><div id="original_category_1" class="nav-header"></div></h3>
       
	   <div id="category_list"> </div>
      
	  </ul>    
    </div>
    <div id="product_list" class="span9">
      <form id="search-box" class="search well hide">
		<input type="text" class="search-query input-xxlarge span10" style="float:left" placeholder="书名&nbsp;&nbsp;/&nbsp;&nbsp;作者&nbsp;&nbsp;/&nbsp;&nbsp;ISBN">
		<button class="btn btn-primary span2" style="float:left">搜索</button>
      </form>
      <div id="type-path">
	  
	  
        <div id="category_relation"></div>
   
   
      </div>
	</div>
  </div>
</div>


<?php include "htm/footer.htm";?>
<?php include "htm/copyright.htm";?>
</body>
</html>